// Cart

// Define module 

var cartModule = (function ()

	{
	// private 
		
		// name of the crop
		var crop;
		
		var weeds;
		
	// public 
		
		return {
			
			
			// initialization
			initModule: function() 
			{
				crop = new Object();
				crop.name = "unknown";
				crop.stage = "unknown";
				weeds = new Object();
			},
			
			// set crop
			setCrop: function(CropName)
			{
				// erase everything
				this.initModule();
				
				// set crop name
				crop.name = CropName;
				
			},
			
			// get crop
			getCrop: function()
			{
				return crop.name;
				
			},
			
			// set crop leafstage
			setCropStageText: function(CropStage)
			{
				crop.stage = CropStage;
			},
			
			// set crop leafstage
			getCropStageText: function()
			{
				return crop.stage;
			},
			
			// set crop leafstage
			setCropStageZadoks: function(Value)
			{
				crop.Zadoks = Value;
			},
			
			// set crop leafstage
			getCropStageZadoks: function()
			{
				return crop.Zadoks;
			},
			
			// add weed 
			addWeed: function(Weed)
			{
				
				if(weeds[Weed] == undefined)
				{
					weeds[Weed] = new Object();
					return true;
				}
				
				return false;
			},
			
			// del weed 
			delWeed: function(Weed)
			{
				delete weeds[Weed];
			},
			
			// number of weeds
			listWeeds: function()
			{
				var weedList = new Array();
				for(var name in weeds) weedList.push(name);
				return weedList;
			},
			
			// set weed stage
			setWeedStageText: function(Weed, Value)
			{
				weeds[Weed].Stage = Value;
			},
				
			// get weed stage
			getWeedStageText: function(Weed)
			{
				return weeds[Weed].Stage;
			},
			
			// set weed stage
			setWeedStageZadoks: function(Weed, Value)
			{
				weeds[Weed].Zadoks = Value;
			},
				
			// get weed stage
			getWeedStageZadoks: function(Weed)
			{
				return weeds[Weed].Zadoks;
			},
			
			// set weed stage
			setHerbicide: function(Weed, Herbicides)
			{
				weeds[Weed].Herbicides = Herbicides;
			},
				
			// get weed stage
			getHerbicide: function(Weed)
			{
				return weeds[Weed].Herbicides;
			}
			
		}
		
	}());
	
